package com.javaee.reflection;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ReflectionExample2 {

    public static void main(String[] args) throws Exception{
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        Book huozhe = (Book) context.getBean("huozhe");
        System.out.println(huozhe);

        Book huozhe1 = (Book) context.getBean("huozhe");
        System.out.println(huozhe1);

        Book santi = (Book) context.getBean("santi");
        System.out.println(santi);

        System.out.println("两次获取的Book对象是否为同一个：" + (huozhe == huozhe1));
    }
}
